package main

import (
	"fmt"
	"go.uber.org/zap"
	"laxkits/lib/laxexec"
	"laxkits/lib/laxutils"
	"laxkits/lib/zlogger"
)

type XmlNode struct {
	Log zlogger.LaxLogNode `xml:"log"`
}

var globalXmlConfig XmlNode

func main() {
	if err := laxutils.LoadXmlFile("../eg.xml", &globalXmlConfig); err != nil {
		fmt.Println(err)
		return
	}
	zlogger.InitLogger(&globalXmlConfig.Log)
	lc := laxexec.NewLaxCommand("slp.cmd")
	lc.ConsoleOutput()
	lc.Run()
	go func() {
		err := lc.Wait()
		zap.S().Info(err)
	}()
	go func() {
		err := lc.Wait()
		zap.S().Info(err)
	}()
	go func() {
		err := lc.Wait()
		zap.S().Info(err)
	}()
	zap.S().Info("Done")
	laxutils.CloseGracefully(nil)
	err := lc.Wait()
	zap.S().Info(err)
}
